home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Processes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  5.2 KB  |  185 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Processes.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __PROCESSES__
  18. #define __PROCESSES__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __EVENTS__
  27. #include <Events.h>
  28. #endif
  29. /*    #include <Quickdraw.h>                                        */
  30. /*        #include <MixedMode.h>                                    */
  31. /*        #include <QuickdrawText.h>                                */
  32. /*    #include <OSUtils.h>                                        */
  33.  
  34. #ifndef __FILES__
  35. #include <Files.h>
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if GENERATINGPOWERPC
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46. #ifdef __CFM68K__
  47. #pragma lib_export on
  48. #endif
  49.  
  50. struct ProcessSerialNumber {
  51.     unsigned long                    highLongOfPSN;
  52.     unsigned long                    lowLongOfPSN;
  53. };
  54. typedef struct ProcessSerialNumber ProcessSerialNumber, *ProcessSerialNumberPtr;
  55.  
  56.  
  57. enum {
  58. /* Process identifier - Various reserved process serial numbers */
  59.     kNoProcess                    = 0,
  60.     kSystemProcess                = 1,
  61.     kCurrentProcess                = 2
  62. };
  63.  
  64. /* Definition of the parameter block passed to _Launch
  65.     Typedef and flags for launchControlFlags field */
  66. typedef unsigned short LaunchFlags;
  67.  
  68.  
  69. enum {
  70. /* Definition of the parameter block passed to _Launch */
  71.     launchContinue                = 0x4000,
  72.     launchNoFileFlags            = 0x0800,
  73.     launchUseMinimum            = 0x0400,
  74.     launchDontSwitch            = 0x0200,
  75.     launchAllow24Bit            = 0x0100,
  76.     launchInhibitDaemon            = 0x0080
  77. };
  78.  
  79. /* Format for first AppleEvent to pass to new process.  The size of the overall
  80.   buffer variable: the message body immediately follows the messageLength */
  81. struct AppParameters {
  82.     EventRecord                        theMsgEvent;
  83.     unsigned long                    eventRefCon;
  84.     unsigned long                    messageLength;
  85. };
  86. typedef struct AppParameters AppParameters, *AppParametersPtr;
  87.  
  88. /* Parameter block to _Launch */
  89. struct LaunchParamBlockRec {
  90.     unsigned long                    reserved1;
  91.     unsigned short                    reserved2;
  92.     unsigned short                    launchBlockID;
  93.     unsigned long                    launchEPBLength;
  94.     unsigned short                    launchFileFlags;
  95.     LaunchFlags                        launchControlFlags;
  96.     FSSpecPtr                        launchAppSpec;
  97.     ProcessSerialNumber                launchProcessSN;
  98.     unsigned long                    launchPreferredSize;
  99.     unsigned long                    launchMinimumSize;
  100.     unsigned long                    launchAvailableSize;
  101.     AppParametersPtr                launchAppParameters;
  102. };
  103. typedef struct LaunchParamBlockRec LaunchParamBlockRec, *LaunchPBPtr;
  104.  
  105. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  106.  Set launchEPBLength to extendedBlockLen for compatibility.*/
  107.  
  108. enum {
  109.     extendedBlock                = ((unsigned)'LC'),
  110.     extendedBlockLen            = (sizeof(LaunchParamBlockRec) - 12)
  111. };
  112.  
  113. enum {
  114. /* Definition of the information block returned by GetProcessInformation */
  115.     modeDeskAccessory            = 0x00020000,
  116.     modeMultiLaunch                = 0x00010000,
  117.     modeNeedSuspendResume        = 0x00004000,
  118.     modeCanBackground            = 0x00001000,
  119.     modeDoesActivateOnFGSwitch    = 0x00000800,
  120.     modeOnlyBackground            = 0x00000400,
  121.     modeGetFrontClicks            = 0x00000200,
  122.     modeGetAppDiedMsg            = 0x00000100,
  123.     mode32BitCompatible            = 0x00000080,
  124.     modeHighLevelEventAware        = 0x00000040,
  125.     modeLocalAndRemoteHLEvents    = 0x00000020,
  126.     modeStationeryAware            = 0x00000010,
  127.     modeUseTextEditServices        = 0x00000008,
  128.     modeDisplayManagerAware        = 0x00000004
  129. };
  130.  
  131. /* Record returned by GetProcessInformation */
  132. struct ProcessInfoRec {
  133.     unsigned long                    processInfoLength;
  134.     StringPtr                        processName;
  135.     ProcessSerialNumber                processNumber;
  136.     unsigned long                    processType;
  137.     OSType                            processSignature;
  138.     unsigned long                    processMode;
  139.     Ptr                                processLocation;
  140.     unsigned long                    processSize;
  141.     unsigned long                    processFreeMem;
  142.     ProcessSerialNumber                processLauncher;
  143.     unsigned long                    processLaunchDate;
  144.     unsigned long                    processActiveTime;
  145.     FSSpecPtr                        processAppSpec;
  146. };
  147. typedef struct ProcessInfoRec ProcessInfoRec, *ProcessInfoRecPtr;
  148.  
  149.  
  150. #if !GENERATINGCFM
  151. #pragma parameter __D0 LaunchApplication(__A0)
  152. #endif
  153. extern pascal OSErr LaunchApplication(const LaunchParamBlockRec *LaunchParams)
  154.  ONEWORDINLINE(0xA9F2);
  155. extern pascal OSErr LaunchDeskAccessory(const FSSpec *pFileSpec, ConstStr255Param pDAName)
  156.  THREEWORDINLINE(0x3F3C, 0x0036, 0xA88F);
  157. extern pascal OSErr GetCurrentProcess(ProcessSerialNumber *PSN)
  158.  THREEWORDINLINE(0x3F3C, 0x0037, 0xA88F);
  159. extern pascal OSErr GetFrontProcess(ProcessSerialNumber *PSN)
  160.  FIVEWORDINLINE(0x70FF, 0x2F00, 0x3F3C, 0x0039, 0xA88F);
  161. extern pascal OSErr GetNextProcess(ProcessSerialNumber *PSN)
  162.  THREEWORDINLINE(0x3F3C, 0x0038, 0xA88F);
  163. extern pascal OSErr GetProcessInformation(const ProcessSerialNumber *PSN, ProcessInfoRec *info)
  164.  THREEWORDINLINE(0x3F3C, 0x003A, 0xA88F);
  165. extern pascal OSErr SetFrontProcess(const ProcessSerialNumber *PSN)
  166.  THREEWORDINLINE(0x3F3C, 0x003B, 0xA88F);
  167. extern pascal OSErr WakeUpProcess(const ProcessSerialNumber *PSN)
  168.  THREEWORDINLINE(0x3F3C, 0x003C, 0xA88F);
  169. extern pascal OSErr SameProcess(const ProcessSerialNumber *PSN1, const ProcessSerialNumber *PSN2, Boolean *result)
  170.  THREEWORDINLINE(0x3F3C, 0x003D, 0xA88F);
  171.  
  172. #ifdef __CFM68K__
  173. #pragma lib_export off
  174. #endif
  175.  
  176. #if GENERATINGPOWERPC
  177. #pragma options align=reset
  178. #endif
  179.  
  180. #ifdef __cplusplus
  181. }
  182. #endif
  183.  
  184. #endif /* __PROCESSES__ */
  185.